SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.3 KB · 25 lines tsx
Raw Blame History
1import { ImageResponse } from 'next/og';2import { Fallback, Wallpaper } from '@/components/brand/og';3import { intel, safe } from '@/lib/api';4import { fmtInt, fmtUsdPerM } from '@/lib/format';5import { SITE_NAME } from '@/lib/site';67export const runtime = 'nodejs';8export const alt = `Provider on ${SITE_NAME}`;9export const size = { width: 1200, height: 630 };10export const contentType = 'image/png';1112export default async function ProviderOgImage({ params }: { params: Promise<{ slug: string }> }) {13  const { slug } = await params;14  const res = await safe(intel.providers());15  const p = res?.items.find((x) => x.slug === slug);16  if (!p) return new ImageResponse(<Fallback label="Provider" />, { ...size });17  const counters: [string, string][] = [18    ['Models served', fmtInt(p.model_count)],19    ['Organizations', fmtInt(p.organizations_covered)],20    ['Median input / 1M', fmtUsdPerM(p.input_price_distribution?.median)],21    ['Median output / 1M', fmtUsdPerM(p.output_price_distribution?.median)],22  ];23  return new ImageResponse(<Wallpaper eyebrow={p.organization ? `Provider · ${p.organization.name}` : 'Provider'} title={p.name} subtitle="Models served, published prices per 1M tokens, distributions, listings and price history — every row with its source." counters={counters} footer={`www.ai-atlas.co/providers/${slug}`} markPx={220} />, { ...size });24}25